<%@ page session="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="tiles" uri="http://tiles.apache.org/tags-tiles" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="security" uri="http://www.springframework.org/security/tags" %>

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<title>
		<fmt:message>
			<tiles:insertAttribute name="title"/>
		</fmt:message>
	</title>
    <link rel="stylesheet" href="<c:url value="/resources/styles/bootstrap/3.3.5/css/bootstrap.min.css" />" />
    <link rel="stylesheet" href="<c:url value="/resources/styles/bootstrap/3.3.5/css/bootstrap-theme.min.css" />" />
    <link rel="stylesheet" href="<c:url value="/resources/styles/pivotal.css" />" />
    <spring:theme var="cssSpringweb" code="css.springweb" />
    <link rel="stylesheet" href="<c:url value="${cssSpringweb}" />" />
</head>
<body>

	<div class="container">
		<div class="row">
			<spring:theme var="cssNavbarClass" code="navbar.class" />
			<nav class="navbar ${cssNavbarClass}">
				<div class="container-fluid">
					<div class="navbar-header">
						<a title="Spring IO" href="http://www.spring.io"> 
							<spring:theme var="bannerImage" code="banner.image" /> 
							<img src="<c:url value="${bannerImage}"/>" height="50"/>
						</a>
					</div>
					<div>
						<ul class="nav navbar-nav">
							<tiles:importAttribute name="navigationTab" />
							<c:if test="${navigationTab eq 'home'}">
								<li class="active">
									<a href="<c:url value="/"/>"> <fmt:message key="navigate.home" /></a>
								</li>
							</c:if> 
							<c:if test="${navigationTab != 'home'}">
								<li>
									<a href="<c:url value="/"/>"><fmt:message key="navigate.home" /></a>
								</li>
							</c:if>
							<c:if test="${navigationTab eq 'accounts'}">
								<li class="active">
									<a href="<c:url value="/accounts/search"/>"><fmt:message key="navigate.accounts" /></a>
								</li>
							</c:if> 
							<c:if test="${navigationTab != 'accounts'}">
								<li>
									<a href="<c:url value="/accounts/search"/>"><fmt:message key="navigate.accounts" /></a>
								</li>
							</c:if>
							<security:authorize access="isAuthenticated()">
								<li>
									<a href="<c:url value="/logout"/>"><fmt:message key="navigate.logout" /></a>
								</li>
							</security:authorize>
						</ul>
						<ul class="nav navbar-nav navbar-right">
							<li>
								<a href="http://www.pivotal.io">
									<img alt="Pivotal" title="Pivotal" height="20" src="<c:url value="/resources/images/pivotal-logo-600.png" />" />
								</a>
							</li>
						</ul>
					</div>
				</div>
			</nav>
		</div>
		
		<!--  Don't show theme options until logged in -->
		<security:authorize access="isAuthenticated()">
			<div class="row">
				<c:if test="${requestContext.locale.language eq 'en'}">
					<c:url var="localeUrl" value="/">
						<c:param name="locale" value="fr"/>
					</c:url>
					<a href="${localeUrl}">
						<fmt:message key="locale.fr" />
					</a>
				</c:if>
				<c:if test="${requestContext.locale.language eq 'fr'}">
					<c:url var="localeUrl" value="/">
						<c:param name="locale" value="en"/>
					</c:url>
					<a href="${localeUrl}">
						<fmt:message key="locale.en" />
					</a>
				</c:if> |
				<c:if test="${requestContext.theme.name eq 'dark'}">
					<c:url var="themeUrl" value="/">
						<c:param name="theme" value="light"/>
					</c:url>
					<a href="${themeUrl}">
						<fmt:message key="theme.Light" />
					</a>
				</c:if>
				<c:if test="${requestContext.theme.name eq 'light'}">
					<c:url var="themeUrl" value="/">
						<c:param name="theme" value="dark"/>
					</c:url>
					<a href="${themeUrl}">
						<fmt:message key="theme.Dark" />
					</a>
				</c:if>						
			</div>
		</security:authorize>
	
		<div class="row">
			<tiles:insertAttribute name="main" />
		</div>
		
		<div class="row">
			<p><fmt:message key="footer.message"/></p>
		</div>	
	

</div>
	
</body>
</html>